﻿namespace FSLib

module Con =
    let for2 x y f = for i in 0..x do for j in 0..y do f i j

module MyArray3D =
    let getCell (ad:'a[,,]) x y =
        (ad.[x,y,0],ad.[x,y,1],ad.[x,y,2])

    let setCell (ad:'a[,,]) x y (b,g,r)=
        ad.[x,y,0] <- b
        ad.[x,y,1] <- g
        ad.[x,y,2] <- r

    let zeroSetB ad:byte[,,] =
        let rlt:byte[,,] = ad
        for x = 0 to Array3D.length1 ad - 1 do
            for y = 0 to Array3D.length2 ad - 1 do
                rlt.[x,y,0] <- 0uy
        rlt

    let zeroSetG ad:byte[,,] =
        let rlt:byte[,,] = ad
        for x = 0 to Array3D.length1 ad - 1 do
            for y = 0 to Array3D.length2 ad - 1 do
                rlt.[x,y,1] <- 0uy
        rlt

    let zeroSetR ad:byte[,,] =
        let rlt:byte[,,] = ad
        for x = 0 to Array3D.length1 ad - 1 do
            for y = 0 to Array3D.length2 ad - 1 do
                rlt.[x,y,2] <- 0uy
        rlt
